import { Controller, Get, Post, UseInterceptors, UploadedFiles } from '@nestjs/common';
import { AppService } from './app.service';
import { FilesInterceptor } from '@nestjs/platform-express';
import { ApiTags } from '@nestjs/swagger';
import { join } from 'path';

@Controller()
@ApiTags("默认")
export class AppController {
  constructor(private readonly appService: AppService) {}

  @Get()
  getHello(): string {
    return join(__dirname, '/', 'adminView');
  }

  @Post('upload')
  @UseInterceptors(FilesInterceptor('file'))
  uploadFile(@UploadedFiles() files) {
    console.log(files)
    return files[0].url;
  }
}
